﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyEighteenthWPFDemo
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        string s = "";

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Calendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
        {
            //this.Title = this.calendar.SelectedDate.ToString();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < this.calendar.SelectedDates.Count; i++)
                s += this.calendar.SelectedDates[i].ToShortDateString() + ";";
            this.Title = s;
        }

        private void DatePicker_DateValidationError(object sender, DatePickerDateValidationErrorEventArgs e)
        {
            MessageBox.Show($"非法日期!\n{e.Exception.Message}");
        }
    }
}
